<?php

namespace app\admin\validate;

use think\Db;
use think\Validate;

class AgentForm extends Validate
{
    protected $rule = [
        'name|代理名字' =>'require|max:200',
        'price|升级所需要费用' =>'require|number|max:32',
        'phone_divide|话费分成' =>'require|float',
        'consume_divide|消费分成' =>'require|float',
        'recommend|需要推广多少人数' =>'require|number|max:6',
        'remarks|备注' =>'max:200',
        'subsidy|补贴金额' =>'require|number|max:32',
    ];
    public function add($array){
      return  Db::name('users_agent')->insert($array);
    }
    public function edit($id,$array){
        return  Db::name('users_agent')->where('id',$id)->update($array);
    }
}